<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

/**
 * Class TbDocumentsClassify
 * 
 * @property int $id
 * @property string $name
 * @property int $weight
 * @property int|null $p_id
 * @property int|null $h_id
 * 
 * @property TbDocumentsClassify|null $tb_documents_classify
 * @property Collection|TbDocument[] $tb_documents
 * @property Collection|TbDocumentsClassify[] $tb_documents_classifies
 *
 * @package App\Models
 */
class TbDocumentsClassify extends Model
{
	protected $table = 'tb_documents_classify';
	public $timestamps = false;

	protected $casts = [
		'weight' => 'int',
		'p_id' => 'int',
		'h_id' => 'int'
	];

	protected $fillable = [
		'name',
		'weight',
		'p_id',
		'h_id'
	];

	public function tb_documents_classify()
	{
		return $this->belongsTo(TbDocumentsClassify::class, 'p_id');
	}

	public function tb_documents()
	{
		return $this->hasMany(TbDocument::class, 'documents_classify_id');
	}

	public function tb_documents_classifies()
	{
		return $this->hasMany(TbDocumentsClassify::class, 'p_id');
	}
}
